<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            height: 100px;
            padding: 10px;
            border: 20px solid #000;
            background-color: lightcoral;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
        // 获取元素对象
        var box=document.querySelector('.box')
        // 获取元素的宽高: 内容+padding+border
        console.log(box.offsetWidth,box.offsetHeight);
        
    </script>
</body>
</html>